Re: Regular Expression Question... llandale - Fri Mar 09 14:19:27 EST 2012
First off, if this is a single enumerated attribute where the user can select "Fixed" or "Closed" etc, then then forget regular expressions and consider this:
-
Value = obj.NameAttr
-
if (Value == "Fixed" or Value == "Close")...
Secoond, if this is a +multi+-enumerated then forget regular expressions and consider this:
-
bool IsFixed = isMember(obj.NameAttr, "Fixed") // Does it include "Fixed"?
-
bool IsClosed = isMember(obj.NameAttr, "Closed")
Now back to your problem. Is it...
-
[A] false when it contains "Fixed" or "Closed"; otherwise true
-
[B] false when it contains "Fixed" or "Closed" or does not contain "Verified"; otherwise true.
Slopply is this:
-
Regexp reFixed = regexp2("Fixed")
-
Regexp reClosed = regexp2("Closed")
-
Regexp reVerif = regexp2("Verified")
-
Value = obj.NameAttr
-
if (reFixed Value or reClosed Value or !reVerif Value) then reject
You could use "matches" but you lose time (a whole lot if your program is large) as it converts all those regexp each time.
-Louie
|